package com.base.common.result;

import java.io.Serializable;

/**
 * @author zhou minghao
 * @date 2024/4/22
 * @description
 */
public class Result extends ResultVo implements Serializable {
    public Result(int code, String msg, Object data) {
        super(code, msg, data);
    }
    /**
    * @Description: 默认请求成功，传回数据
    * @Param:
    * @return:
    * @Author: zhou minghao
    * @Date: 16:19 2024/4/22
    */
    public static ResultVo success(Object data){
        return new Result(ResultCode.SUCCESS.getCode(),ResultCode.SUCCESS.getMsg(),data);
    }

    /**
    * @Description: 请求成功，不返回数据
    * @Param:
    * @return:
    * @Author: zhou minghao
    * @Date: 16:19 2024/4/22
    */
    public static ResultVo success(){
        return new ResultVo(ResultCode.SUCCESS.getCode(),ResultCode.SUCCESS.getMsg(),null);
    }

    /**
    * @Description: 请求失败，返回数据
    * @Param:
    * @return:
    * @Author: zhou minghao
    * @Date: 16:21 2024/4/22
    */
    public static ResultVo error(Object data){
        return new ResultVo(ResultCode.ERROR.getCode(),ResultCode.ERROR.getMsg(), data);
    }

    /**
    * @Description: 请求失败，不返回数据
    * @Param:
    * @return:
    * @Author: zhou minghao
    * @Date: 16:22 2024/4/22
    */
    public static ResultVo error(){
        return new ResultVo(ResultCode.ERROR.getCode(),ResultCode.ERROR.getMsg(), null);
    }

    /**
    * @Description: 请求失败，返回信息与数据
    * @Param:
    * @return:
    * @Author: zhou minghao
    * @Date: 16:22 2024/4/22
    */
    public static ResultVo error(String msg , Object data){
        return new ResultVo(ResultCode.ERROR.getCode(),msg, data);
    }

    /**
    * @Description: 请求失败，返回错误信息 
    * @Param:  
    * @return:  
    * @Author: zhou minghao
    * @Date: 11:13 2024/4/23
    */ 
    public static ResultVo error(String msg){
        return new ResultVo(ResultCode.ERROR.getCode(),msg,null);
    }


}
